import QtQuick 2.12
import QtQuick.Window 2.12
import TaoQuick 1.0
import Top 1.0

Item {
    Column {
        anchors.centerIn: parent
        spacing: 20
        Row {
            anchors.horizontalCenter: parent.horizontalCenter
            CusLabel {
                text: "账号"
                width: 60
                anchors.verticalCenter: parent.verticalCenter
            }

            CusTextField {
                id: accountId
                width: 200
                height: 30
            }
            //这样可以保持前面的输入框不动
            Item {
                width: 1
                height: 30
                CusLabel {
                    anchors.verticalCenter: parent.verticalCenter
                    text: GlobalManager.tcpClientManager.loginStatus
                    color: "red"
                    font.pixelSize: 17
                    leftPadding: 10
                    width: 200
                }
            }
        }
        Row {
            anchors.horizontalCenter: parent.horizontalCenter
            CusLabel {
                text: "密码"
                width: 59
                anchors.verticalCenter: parent.verticalCenter
            }

            CusTextField {
                id: passwordId
                width: 200
                height: 30
            }
        }
        Row {
            spacing: 20
            anchors.horizontalCenter: parent.horizontalCenter
            CusButton {
                width: 80
                height: 40
                text: "注册"
                onClicked:  {
                    displayIndex = 1
                }
            }

            CusButton {
                width: 80
                height: 40
                enabled: accountId.text != "" && passwordId.text != ""
                text: "登录"
                onClicked: {
                    GlobalManager.tcpClientManager.loginAccount(accountId.text, passwordId.text)
                }
            }
        }
    }
}
